package com.example.javabase.multithread.volatileTest;

/**
 * @author He Changjie on 2021/7/11
 */
public class Main {
    public static volatile boolean stopped = false;
    public static void main(String[] args) {
        Thread thread = new Thread() {
            @Override
            public void run() {
                while (!stopped) {

                }
            }
        };
        thread.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        stopped = true;
    }

}
